package git.soulbgm.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.client.RestTemplate;

/**
 * @author SoulBGM
 * @version 1.0
 * @date 2020/7/26 22:45
 */
@RestController
public class DemoController {

    private final RestTemplate restTemplate;

    @Autowired
    public DemoController(RestTemplate restTemplate) {
        this.restTemplate = restTemplate;
    }

    @RequestMapping("echo/{text}")
    public String echo(@PathVariable String text) {
        return restTemplate.getForObject("http://nacos-provider/echo/" + text, String.class);
    }

}
